package com.xukai.springboot.util.common;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ExcludeApiCache {
    private List<String> Excludes = new ArrayList<String>();

    private static ExcludeApiCache instance;

    public static ExcludeApiCache getInstance() {
        if (instance == null) {
            synchronized (Common.class) {
                if (instance == null) {
                    instance = new ExcludeApiCache();
                }
            }
        }
        return instance;
    }

    /**
     * 是否存在
     *
     * @param api
     * @return
     */
    public boolean isExist(String api) {
        if (Excludes.indexOf(api) == -1) {
            return false;
        }
        return true;
    }

    /**
     * 添加缓存
     *
     * @param api
     */
    public void add(String api) {
        if (Excludes.indexOf(api) == -1) {
            Excludes.add(api);
        }
    }
}
